package com.molichuxing.job;

import com.molichuxing.service.InsuranceJobService;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.IJobHandler;
import com.xxl.job.core.handler.annotation.JobHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@JobHandler(value="insuranceJobService")
@Component
public class InsuranceCreateImgHandler  extends IJobHandler {

    private static final Logger logger = LoggerFactory.getLogger(InsuranceCreateImgHandler.class);

    @Resource
    InsuranceJobService insuranceJobService;

    @Override
    public ReturnT<String> execute(String param) throws Exception {
        ReturnT<String> returnT = ReturnT.SUCCESS;
        logger.info("==============创建保单图片定时任务start================");
        boolean result = insuranceJobService.createInsuranceImgByPdf();
        if (!result) {
            returnT = ReturnT.FAIL;
        }
        logger.info("==============创建保单图片定时任务end================");
        returnT.setContent("创建保单图片定时任务结果result：" + result);
        return returnT;
    }

}
